/*
 *  ECE552H1 F Assignment 3
 *  File Name: mbq3.c
 *  Author: Mustafa Abbas
 *  Description:
 *      A microbenchmark that executes a fixed number of
 *      sequential memory accesses with strides to test a stride prefetcher
 */

#define BENCHMARK_SIZE 1000000

int main () {
    int i = 0;
    int x[BENCHMARK_SIZE];
    int y[BENCHMARK_SIZE];

    /* The loop below will access the memory in a strides, to test the next
       line prefetecher. */
    for (i=0; i<BENCHMARK_SIZE; i++) {
        y[BENCHMARK_SIZE-1-i] = x[i];
    }
    return 0;
}

/* 
   Here is the assembly output of the compiled program
   	.file	1 "mbq3.c"

 # GNU C 2.7.2.3 [AL 1.1, MM 40, tma 0.1] SimpleScalar running sstrix compiled by GNU C

 # Cc1 defaults:
 # -mgas -mgpOPT

 # Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
 # -quiet -dumpbase -O2 -o

gcc2_compiled.:
__gnu_compiled_c:
	.text
	.align	2
	.globl	main

	.text

	.loc	1 12
	.ent	main
main:
	.frame	$sp,8000024,$31		# vars= 8000000, regs= 1/0, args= 16, extra= 0
	.mask	0x80000000,-8
	.fmask	0x00000000,0
	li	$8,0x007a1218		# 8000024
	subu	$sp,$sp,$8
	addu	$9,$8,$sp
	sw	$31,-8($9)
	jal	__main
	move	$4,$0
	li	$7,0x000f0000		# 983040
	ori	$7,$7,0x423f
	li	$8,0x003d0000		# 3997696
	ori	$8,$8,0x0900
	addu	$6,$sp,16
	move	$5,$6
$L5:
	.set	noreorder
	lw	$2,0($5)
	.set	reorder
	subu	$3,$7,$4
	addu	$4,$4,1
	sll	$3,$3,2
	addu	$3,$3,$6
	addu	$3,$3,$8
	addu	$5,$5,4
	sw	$2,0($3)
	slt	$2,$7,$4
	beq	$2,$0,$L5
	move	$2,$0
	li	$8,0x007a1218	# 8000024
	addu	$9,$8,$sp
	lw	$31,-8($9)
	addu	$sp,$sp,$8
	j	$31
	.end	main
*/
